package stc.skymobi.launcher;


import static org.junit.Assert.*;

import java.util.HashMap;
import java.util.Map;

import org.apache.commons.beanutils.PropertyUtils;
import org.junit.After;
import org.junit.AfterClass;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Test;

public class MapAsBeanTestCase {

	@BeforeClass
	public static void setUpBeforeClass() throws Exception {
	}

	@AfterClass
	public static void tearDownAfterClass() throws Exception {
	}

	@Before
	public void setUp() throws Exception {
	}

	@After
	public void tearDown() throws Exception {
	}

	@Test
	public void testMapAsBean() throws Exception {
		Map<String, Object> bean = new HashMap<String, Object>();
		
		assertNull( PropertyUtils.getProperty(bean, "name") );

		bean.put("name", "marvin");
		
		assertEquals( PropertyUtils.getProperty(bean, "name"), "marvin" );
		
		assertNull( PropertyUtils.getProperty(bean, "age") );

		bean.put("age", 34);
		
		assertEquals( PropertyUtils.getProperty(bean, "age"), 34 );
	}
}
